/*
 * Test to Brain.java
 * 15.06.2012
 */
package human;

import static org.junit.Assert.*;
import human.Brain;
import human.Organ;

import org.junit.Before;
import org.junit.Test;

/**
 * Tests to Brain.java
 * 
 * @author Vasyl Khyzhniak
 * @version 1.1
 */
public class BrainTest {

	Brain brainTest;

	@Before
	public void setUp() {
		brainTest = new Brain();
	}

	@Test
	public void shouldBeCorrectHealthWhenBrainCreated() {
		// given

		// when

		// then
		assertEquals(0, brainTest.getHealth());
	}

	@Test
	public void shouldBeCorrectFatigueWhenBrainCreated() {
		// given

		// when

		// then
		assertEquals(0, brainTest.getFatigue());
	}

	@Test
	public void shouldBeCorrectMemoryWhenBrainCreated() {
		// given

		// when

		// then
		assertEquals(0, brainTest.getMemory());
	}

	@Test
	public void shouldBeCorrectOxygenationWhenBrainCreated() {
		// given

		// when

		// then
		assertEquals(0, brainTest.getOxygenation());
	}

	@Test
	public void shouldBeNecessaryForLifeWhenBrainCreated() {
		// given

		// when

		// then
		assertEquals(true, brainTest.getLifeImportance());
	}

	@Test
	public void shouldBeModifiedFatigueWhenChanging() {
		// given

		// when
		brainTest.changeFatigue(15);
		// then
		assertEquals(15, brainTest.getFatigue());
	}

	@Test
	public void shouldBeModifiedMemoryWhenChanging() {
		// given

		// when
		brainTest.changeMemory(15);
		// then
		assertEquals(15, brainTest.getMemory());
	}

	@Test
	public void shouldBeModifiedOxygenationhWhenChanging() {
		// given

		// when
		brainTest.changeOxygenation(15);
		// then
		assertEquals(15, brainTest.getOxygenation());
	}

	@Test
	public void shouldControlLowerLimitWhenFatigueModified() {
		// given

		// when
		brainTest.changeFatigue(Organ.LOWER_LIMIT - 10);
		// then
		assertEquals(Organ.LOWER_LIMIT, brainTest.getFatigue());
	}

	@Test
	public void shouldControlLowerLimitWhenMemoryModified() {
		// given

		// when
		brainTest.changeMemory(Organ.LOWER_LIMIT - 10);
		// then
		assertEquals(Organ.LOWER_LIMIT, brainTest.getMemory());
	}

	@Test
	public void shouldControlLowerLimitWhenOxygenationModified() {
		// given

		// when
		brainTest.changeOxygenation(Organ.LOWER_LIMIT - 10);
		// then
		assertEquals(Organ.LOWER_LIMIT, brainTest.getOxygenation());
	}

	@Test
	public void shouldControlUpperLimitWhenFatigueModified() {
		// given

		// when
		brainTest.changeFatigue(Organ.UPPER_LIMIT + 10);
		// then
		assertEquals(Organ.UPPER_LIMIT, brainTest.getFatigue());
	}

	@Test
	public void shouldControlUpperLimitWhenMemoryModified() {
		// given

		// when
		brainTest.changeMemory(Organ.UPPER_LIMIT + 10);
		// then
		assertEquals(Organ.UPPER_LIMIT, brainTest.getMemory());
	}

	@Test
	public void shouldControlUpperLimitWhenOxygenationModified() {
		// given

		// when
		brainTest.changeOxygenation(Organ.UPPER_LIMIT + 10);
		// then
		assertEquals(Organ.UPPER_LIMIT, brainTest.getOxygenation());
	}

}
